import Mock from 'mockjs'
const list = Mock.mock({
  'list|10': [
    {
      msPushId: '@id',
      title: '@csentence',
      sendUserName: '@cname',
      text: '@csentence',
      pushCode: '@integer',
      'sendMode|1': [2, 1],
      'pushType|1': [2, 1],
      createTime: '@date',
      userName: '@cname',
      userTel: '@integer(3)',
      'status|1': [1, 2]
    }
  ]
})
const dictMap = {
  pushType: {
    1: 'text',
    2: 'text2'
  },
  sendMode: {
    1: 'www',
    2: '333'
  },
  status: {
    1: '成功',
    2: '失败'
  }
}
const model = Mock.mock({
  'list|10': [
    {
      templateId: '@id',
      title: '@csentence',
      ticker: '@csentence',
      'pushType|1': [2, 1],
      text: '@string',
      pushCode: '@string',
      sound: '@string'
    }
  ]
})
const pub = {
  isMore: 0,
  pageIndex: 1,
  pageSize: 10,
  startIndex: 0,
  totalNum: 30,
  totalPage: 1
}

export default [
  // 消息推送
  // 分页查询推送列表
  {
    url: '/general/push/listMsPush',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 分页查询推送接收人
  {
    url: '/general/push/listMsPushUser',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        msg: ''
      }
    }
  },
  // 发送推送
  {
    url: '/general/push/sendMsPush',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  // 根据ID查询推送
  {
    url: '/general/push/viewMsPushById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: list.list[0],
        msg: ''
      }
    }
  },
  // 消息推送模板
  // 添加推送模板
  {
    url: '/general/push/addPushTemplate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...model },
        msg: ''
      }
    }
  },
  // 根据推送模板ID删除
  {
    url: '/general/push/deletePushTemplateById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: model.list[0],
        msg: ''
      }
    }
  },
  // 分页查询推送模板
  {
    url: '/general/push/listPushTemplate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...model,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 修改推送模板
  {
    url: '/general/push/modifyPushTemplate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...model },
        msg: ''
      }
    }
  },
  // 根据推送模板ID查询
  {
    url: '/general/push/viewPushTemplateById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: model.list[0],
        msg: ''
      }
    }
  }
]
